package com.tudouji.project.mt.controller;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.tudouji.framework.aspectj.lang.annotation.Log;
import com.tudouji.framework.aspectj.lang.enums.BusinessType;
import com.tudouji.project.mt.domain.MtFoodcostcarditem;
import com.tudouji.project.mt.service.IMtFoodcostcarditemService;
import com.tudouji.framework.web.controller.BaseController;
import com.tudouji.framework.web.domain.AjaxResult;
import com.tudouji.common.utils.poi.ExcelUtil;
import com.tudouji.framework.web.page.TableDataInfo;

/**
 * 美团成本卡明细明细Controller
 * 
 * @author tudouji
 * @date 2023-12-04
 */
@RestController
@RequestMapping("/mt/foodcostcarditem")
public class MtFoodcostcarditemController extends BaseController
{
    @Autowired
    private IMtFoodcostcarditemService mtFoodcostcarditemService;

    /**
     * 查询美团成本卡明细明细列表
     */
    @PreAuthorize("@ss.hasPermi('mt:foodcostcarditem:list')")
    @GetMapping("/list")
    public TableDataInfo list(MtFoodcostcarditem mtFoodcostcarditem)
    {
        startPage();
        List<MtFoodcostcarditem> list = mtFoodcostcarditemService.selectMtFoodcostcarditemList(mtFoodcostcarditem);
        return getDataTable(list);
    }

    /**
     * 导出美团成本卡明细明细列表
     */
    @PreAuthorize("@ss.hasPermi('mt:foodcostcarditem:export')")
    @Log(title = "美团成本卡明细明细", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(MtFoodcostcarditem mtFoodcostcarditem)
    {
        List<MtFoodcostcarditem> list = mtFoodcostcarditemService.selectMtFoodcostcarditemList(mtFoodcostcarditem);
        ExcelUtil<MtFoodcostcarditem> util = new ExcelUtil<MtFoodcostcarditem>(MtFoodcostcarditem.class);
        return util.exportExcel(list, "foodcostcarditem");
    }

    /**
     * 获取美团成本卡明细明细详细信息
     */
    @PreAuthorize("@ss.hasPermi('mt:foodcostcarditem:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(mtFoodcostcarditemService.selectMtFoodcostcarditemById(id));
    }

    /**
     * 新增美团成本卡明细明细
     */
    @PreAuthorize("@ss.hasPermi('mt:foodcostcarditem:add')")
    @Log(title = "美团成本卡明细明细", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody MtFoodcostcarditem mtFoodcostcarditem)
    {
        return toAjax(mtFoodcostcarditemService.insertMtFoodcostcarditem(mtFoodcostcarditem));
    }

    /**
     * 修改美团成本卡明细明细
     */
    @PreAuthorize("@ss.hasPermi('mt:foodcostcarditem:edit')")
    @Log(title = "美团成本卡明细明细", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody MtFoodcostcarditem mtFoodcostcarditem)
    {
        return toAjax(mtFoodcostcarditemService.updateMtFoodcostcarditem(mtFoodcostcarditem));
    }

    /**
     * 删除美团成本卡明细明细
     */
    @PreAuthorize("@ss.hasPermi('mt:foodcostcarditem:remove')")
    @Log(title = "美团成本卡明细明细", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(mtFoodcostcarditemService.deleteMtFoodcostcarditemByIds(ids));
    }
}
